const state = {
  token: localStorage.getItem('token') || '',
}

const mutations = {
  SET_TOKEN(state, token) {
    state.token = token

    if (token) {
      localStorage.setItem('token', token)
    } else {
      localStorage.removeItem('token')
    }
  },
}

const actions = {
}

export const user = {
  namespaced: true,
  state,
  mutations,
  actions
}
